if redis.call("get",KEYS[1]) == ARGV[1]
then
    return redis.call("del",KEYS[1])
else
    return 0
end

redis.call("del",KEYS[1])
redis.call("del","{"..KEYS[1].."}:config")
redis.call("rename",KEYS[2],KEYS[1])
redis.call("rename","{"..KEYS[2].."}:config","{"..KEYS[2].."}:config")
return 1